package com.googlecode.garbagecan.simonstudy;

import org.javasimon.SimonManager;
import org.javasimon.Split;
import org.javasimon.Stopwatch;
import org.javasimon.utils.SimonUtils;

public class Test1 {

	public static void main(String[] args) throws Exception {
		Stopwatch stopwatch = SimonManager.getStopwatch(Test1.class.getName());
		for (int i = 0; i < 10; i++) {
			Split split = stopwatch.start();
			Thread.sleep((long) (Math.random() * 1000L));
			long time = split.stop();
		}

		long totalNanos = stopwatch.getTotal();
		long maxSplit = stopwatch.getMax();
		long minSplit = stopwatch.getMin();

		System.out.println("Total time: " + SimonUtils.presentNanoTime(totalNanos));
		System.out.println("Max time: " + SimonUtils.presentNanoTime(maxSplit));
		System.out.println("Min time: " + SimonUtils.presentNanoTime(minSplit));

		System.out.println(stopwatch);
	}
}
